#!/usr/bin/make -f

build_dir   = build
install_dir = debian/uya

PYVERS=$(shell pyversions -vr)

binary: binary-indep

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installman
	dh_installmenu
	dh_installexamples
	dh_install --sourcedir $(install_dir)
	dh_desktop
	dh_fixperms
	dh_pycentral
	dh_compress -X.py
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

build: $(PYVERS:%=build-python%)
	touch $@

build-python%:
	dh_testdir
	python$* setup.py build --quiet --build-base $(build_dir)
	touch $@

install: build $(PYVERS:%=install-python%)

install-python%:
	python$* setup.py install --no-compile --root=$(install_dir)

clean:
	dh_testdir
	rm -f build-stamp
	python setup.py clean
	find . -name "*.pyc" | xargs rm -f
	find . -name "*.pyo" | xargs rm -f
	rm -rf $(build_dir) $(install_dir) build-python2.4 build-python2.5
	dh_clean

.PHONY: binary binary-indep install build clean
